﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.API.Applications.Command.AquacultureCommand;
using Traceability.Domain;
using Traceability.ErrorCode;

namespace Traceability.API.Controllers
{
    /// <summary>
    /// 养殖信息 控制器 ——API
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AquacultureController : ControllerBase
    {
        private readonly IMediator mediator;

        public AquacultureController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 养殖信息添加66666
        /// 养殖信息添加7777777
        /// </summary>
        /// <param name="command">参数</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> AquacultureAdd(AquacultureAddCommand command)
        {
            return await mediator.Send(command);
        }


        /// <summary>
        /// 养殖信息显示
        /// </summary>
        /// <param name="command">参数</param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<Aquaculture_Information>> AquacultureShow([FromQuery]AquacultureQueryCommand command)
        {
            return mediator.Send(command);
        }


        /// <summary>
        /// 添加保健信息
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> HealthcareAdd(HealthcareAddCommand command)
        {
            return await mediator.Send(command);
        }


        /// <summary>
        /// 获取保健信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<List<Healthcare_Information>>> HealthcareGet([FromQuery]HealthcareQueryCommand command)
        {
            return  mediator.Send(command);

        }

        /// <summary>
        /// 修改保健信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> HealthcareUp(HealthcareUpCommand command)
        {
            return await mediator.Send(command);

        }

        /// <summary>
        /// 删除保健信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> HealthcareDel([FromQuery]HealthcareDelCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 添加养殖企业信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> FarmAdd(FarmAddCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 显示养殖企业信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<Farm>> FarmQuery([FromQuery]FarmQueryCommand command)
        {
            return mediator.Send(command);
        }
    }
}
